package day05;
import java.util.Arrays;
public class Practice02 {
    public static void main(String[] args) {
        //1.MaxOfArray求数组元素最大值并放在最后一个元素的下一个位置
        //要求：声明整型数组并填充随机数据，找到最大值，将数组扩容并将最大值放末尾
        int arr1[]= new int[10];
        for (int a = 0;a<arr1.length;a++){
            arr1[a]=(int)(Math.random()*50);
        }
        Arrays.sort(arr1);
        int max1 = arr1[arr1.length-1];

        arr1=Arrays.copyOf(arr1,arr1.length+1);
        arr1[arr1.length-1]=max1;
        System.out.println(arr1[arr1.length-1]);

        //2.方法的练习
        //方法的调用
        say01();
        say02(06);
        say03(24,"工作");
        int testMethod1 = workNumb();
        int testMethod2 = plus(22,33);
        int[]arr3=testArray();
        for (int l =0;l<arr3.length;l++){
            System.out.println(arr3[l]);
        }

    }

    //各种方法
    public static void say01(){
        System.out.println("当前时间21点，请注意安排休息时间");
    }
    public static void  say02(int time){
        System.out.println("当前时间"+time+"点,请注意安排休息时间");
    }
    public static void  say03(int time,String type){
        System.out.println("当前时间"+time+"点，请注意安排"+type+"时间");
    }
    public static int workNumb(){
        return 955;
    }
    public static int plus(int a1,int a2){
        return a1*a2;
    }
    public static int[]testArray(){
       int[]arr2 = new int[5];
       for (int k =0;k< arr2.length;k++){
        arr2[k]=(int)(Math.random()*100+1);
       }
       return arr2;
    }


}
